package tsing.javase.quartz;

import org.quartz.*;

/**
 * @Date 2023/9/22 14:17
 */
// 不允许并发执行
@DisallowConcurrentExecution
public class TestJob  implements Job {

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        String name = "";
        try {
            JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap();
             name = (String)jobDataMap.get("name");

            System.out.println(Thread.currentThread().getName()+"JOB:"+name+"-开始休眠！！！");
            Thread.sleep(30000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(Thread.currentThread().getName()+"JOB:"+name+"执行结束！！！");
    }
}
